package test.methodhandle;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;

/**
 * @author yachao.guo
 * @date 2019-06-05 14:47
 */
public class Foo {

    public static void bar(Object o){
        new Exception().printStackTrace();
    }
    public static void main(String[] args) throws Throwable {
        MethodType methodType = MethodType.methodType(void.class,Object.class);
        MethodHandle methodHandle = MethodHandles.lookup().findStatic(Foo.class,"bar",methodType);
        methodHandle.invokeExact(new Object());
    }
}
